//
//  main.m
//  oc_17
//
//  Created by 楼楚 on 15/9/15.
//  Copyright (c) 2015年 Chu Lou. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Dog.h"
int main(int argc, const char * argv[]) {
    @autoreleasepool {
       
        Dog *dog = [[Dog alloc]init];// 开辟了一个内存空间 指针dog指向该空间
        NSLog(@"%zd",dog.retainCount);
        
        Dog *dog1 = [dog retain];
        NSLog(@"%zd",dog.retainCount);
        Dog *dog2 = [dog retain];
        NSLog(@"%zd",dog.retainCount);
        
        [dog1 release];
        dog1 = nil;
        NSLog(@"%zd",dog.retainCount);
        [dog2 release];
        dog2 = nil;
        NSLog(@"%zd",dog.retainCount);
        [dog release];
        dog = nil;
        NSLog(@"%zd",dog.retainCount);
//        分析 当引用计数器为0的时候 系统要回收内存
//        稀构方法
//        内存管理的黄金法则 ：对一个oc对象进行alloc retain copy mutablecopy的时候需要对该对象进行release或者autorelease操作
        
        
    }
    return 0;
}
